import QtQuick 1.1
import com.nokia.meego 1.1
import StarMenu 1.0

Item {



    StarMenu {
        id: starMenu
        objectName: "Menu2"
        anchors.fill: parent
        smooth: true
        radiusH: 120
        radiusV: 120
        visualParent: main
        delayChangePos: 100
        starCenterVisible: true
        center.x: main.width>>1
        center.y: main.height>>1

//        onOpenChanged: {console.log("open",open); controls.visible = open; }

        Column {
            id: controls
            parent: main
            visible: starMenu.open
            x: main.width-controls.width
            y: main.height-controls.height
            z: main.z+1
            spacing: 0

            Row {
                Text {
                    text: "radiusH"
                    font {bold: true; pixelSize: 30}
                    color: "#ffffff"
                }
                Slider {
                    valueIndicatorVisible: true
                    minimumValue:0; maximumValue:300; width:250
                    Component.onCompleted: value = starMenu.radiusH
                    onValueChanged: starMenu.radiusH = value
                }
            }
            Row {
                Text {
                    text: "radiusV"
                    font {bold: true; pixelSize: 30}
                    color: "#ffffff"
                }
                Slider {
                    valueIndicatorVisible: true
                    minimumValue:0; maximumValue:300; width:250
                    Component.onCompleted: value = starMenu.radiusV
                    onValueChanged: starMenu.radiusV = value
                }
            }
            Row {
                Text {
                    text: "rotation"
                    font {bold: true; pixelSize: 30}
                    color: "#ffffff"
                }
                Slider {
                    valueIndicatorVisible: true
                    minimumValue:0; maximumValue:90; width:250
                    Component.onCompleted: value = starMenu.rotation
                    onValueChanged: starMenu.rotation = value
                }
            }
        }


        onStarMenuOpening: { textRect.text =
           "<font size=4>StarItems can be automatically animated by setting <strong>StarMenu property "+
           "delayChangePos = [ms delay]</strong>. If StarItem property delayChangePos is set, "+
           "it will get <strong>priority over the StarMenu's delayChangePos</strong>.<br><br>"+
           "Here the StarMenu <strong>useParentMenuCenter</strong> property is set to true making "+
           "the sub menu center to point to its parent center.</font>";
            textRect.z = starMenu.z;
        }

        Behavior on rotation { NumberAnimation { duration: 1000; easing.type: Easing.OutQuad } }

        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            onClicked: console.log("HOVER ITEM STARITEM 1 CLICKED");

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0007.png"
            }
        }
        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            onClicked: console.log("HOVER ITEM STARITEM 2 CLICKED");

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0003.png"
            }
        }

        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0012.png"
            }
        }
        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0014.png"
            }
        }

        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on scale { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                id: image
                Behavior on scale { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "qt.png"
            }

            StarMenu {
                id: starMenu2
                anchors.fill: parent; smooth: true
                radiusH: 80
                radiusV: 80
                starCenterVisible: false
                useParentMenuCenter: true


                Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                StarItem {
                    width: 64; height: 64
                    Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                    Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0001.png"
                    }
                }
                StarItem {
                    width: 64; height: 64
                    Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                    Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "qt.png"
                    }
                    StarMenu {
                        id: starMenu3
                        anchors.fill: parent; smooth: true
                        radiusH: 80
                        radiusV: 80
                        starCenterVisible: false
                        useParentMenuCenter: true

                        Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                        Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                        StarItem {
                            width: 32; height: 32
                            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0011.png"
                            }
                        }
                        StarItem {
                            width: 48; height: 48
                            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0012.png"
                            }
                        }
                        StarItem {
                            width: 32; height: 32
                            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0007.png"
                            }
                        }
                        StarItem {
                            width: 48; height: 48
                            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0002.png"
                            }
                        }

                    }

                }
                StarItem {
                    width: 64; height: 64
                    Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                    Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0008.png"
                    }
                }
                StarItem {
                    width: 64; height: 64
                    Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                    Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0009.png"
                    }
                }


                StarItem {
                    width: 64; height: 64
                    Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
                    Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0010.png"
                    }

                }

            }
        }


        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on scale { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0001.png"
            }
        }

        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0013.png"
            }
        }
        StarItem {
            width: 64; height: 64
            Behavior on x { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }
            Behavior on y { NumberAnimation { duration: 1500; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0009.png"
            }
        }


    }


}

